package com.nan.hrm.controller;

import com.nan.hrm.doc.CourseDoc;
import com.nan.hrm.dto.CourseSearchDto;
import com.nan.hrm.service.CourseEsService;
import com.nan.hrm.util.AjaxResult;
import com.nan.hrm.util.PageList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/escourse")
public class CourseEsController {
    @Autowired
    private CourseEsService courseEsService;
    @RequestMapping("/course")
    public AjaxResult save(@RequestBody CourseDoc courseDoc){
        System.out.println(courseDoc);
        return courseEsService.save(courseDoc);
    }
    @DeleteMapping("/{id}")
    public AjaxResult delete(@PathVariable("id") Long id){
        return courseEsService.delete(id);
    }

    @PostMapping("/searchCourse")
    public AjaxResult searchCourse(@RequestBody CourseSearchDto courseSearchDto){
        return courseEsService.searchCourse(courseSearchDto);
    }
}
